package com.example.myapplication;

import android.content.Intent;
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class Me extends AppCompatActivity implements View.OnClickListener {

    ListView listView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_me);
        listView = (ListView) findViewById(R.id.melist);
        List<People> people = new ArrayList<>();
        for (int i = 0; i <1 ; i++)
        {
            People game_setting = new People(R.drawable.right,"推送设置");
            people.add(game_setting);
            People putong_setting = new People(R.drawable.right,"通用设置");
            people.add(putong_setting);
            People yinsi_setting = new People(R.drawable.right,"隐私设置");
            people.add(yinsi_setting);
            People help = new People(R.drawable.right,"帮助");
            people.add(help);
            People about_this = new People(R.drawable.right,"关于广科游戏论坛");
            people.add(about_this);
        }
        PeopleAdapter adapter=new PeopleAdapter(Me.this,R.layout.meitem,people);
        listView.setAdapter(adapter);

        initView();

    }

    private void initView()
    {
        ImageButton home = findViewById(R.id.home);
        ImageButton game = findViewById(R.id.games);
        ImageButton msg = findViewById(R.id.msg);
        home.setOnClickListener(this);
        game.setOnClickListener(this);
        msg.setOnClickListener(this);
    }

    public void onClick (View v)
    {
        switch (v.getId())
        {
            case R.id.home:
                Intent intent = new Intent(Me.this,MainActivity.class);
                startActivity(intent);
                overridePendingTransition(0,0);
                finish();
                break;
            case R.id.games:
                Intent intent1 = new Intent(Me.this,Game.class);
                startActivity(intent1);
                overridePendingTransition(0,0);
                finish();
                break;
            case R.id.msg:
                Intent intent2 = new Intent(Me.this,Msg.class);
                startActivity(intent2);
                overridePendingTransition(0,0);
                finish();
                break;
        }
    }
}